features:
  - id: f1
    feature: A confirmed refund records the attempt, moves the order to `refunded`
      and publishes order-refunded
    kind: step
    implemented: One handler records the `refund` row, updates the order and emits
      the event — api://payments/refunds · db://main/orders ·
      event://order-refunded
    gap: —
    owner: "[Robin Cross](</Team/Robin Cross.md>)"
    tests: test://payments/refunds.test.ts
    uuid: ad890dd1-e63a-428b-bd76-99f8dc518e43
  - id: f2
    feature: A partial refund keeps the order `fulfilled` until the amounts add up
      to the total
    kind: rule
    implemented: The handler compares refunded totals before changing status —
      api://payments/refunds
    gap: Whether partial refunds deserve their own status is undecided — see q1
    owner: "[Robin Cross](</Team/Robin Cross.md>)"
    tests: —
    uuid: 35b04954-8222-45dc-9f68-2bf48ac26731
scenarios:
  - id: s1
    scenario: Provider confirms the refund
    kind: happy
    outcome: attempt recorded, order `refunded`, event published, buyer notified
    result: refunded
    tests: test://payments/refunds.test.ts
    uuid: e3d31b84-d093-464f-a0f0-afd998094c11
  - id: s2
    scenario: Provider rejects the refund (window expired, already disputed)
    kind: unhappy
    outcome: attempt recorded as `failed`; order unchanged; agent sees the provider
      reason
    result: order unchanged
    tests: —
    uuid: e50d0b0b-98f5-4b38-a947-f8f8a0e62759
  - id: s3
    scenario: Partial refund of a multi-item order
    kind: edge
    outcome: amount below total; order stays `fulfilled` until fully refunded
    result: order unchanged
    tests: —
    uuid: 1fb77e16-c1e1-4b31-a9f8-c1c01ee6a743
open-questions:
  - q: q1
    question: What does the order status become when refunds are partial — new state
      or stay `fulfilled`?
    about: f2
    status: open
    options: 'Stay fulfilled (Recommended) :: the enum stays small and "partially
      refunded" is derivable from the attempts — document the invariant; Add a
      partially-refunded status :: support filters on it daily, which a derived
      value cannot serve'
    uuid: a5e01854-e3fe-4b29-9660-d088b6d37094
    resolution: ""
    owner: ""
